package com.fancy.learncenter.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.activity.FancyActivityDetailActivity;
import com.fancy.learncenter.activity.TrainApplyDetailActivity;
import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.fancy.learncenter.bean.CollectDataBean;
import com.fancy.learncenter.bean.TrainApplyListDataBean;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/1/27.
 * Explain activity as
 */

public class ToothCollectMoveAdapter extends CommonRecycleViewAdapter<CollectDataBean> {

    public ToothCollectMoveAdapter(Context mContext, ArrayList<CollectDataBean> itemDatas) {
        super(mContext, R.layout.fragment_train_apply_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CollectDataBean item, int position) {

        SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getPoster());

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, FancyActivityDetailActivity.class);
                intent.putExtra("trainId", item.getId());
                mContext.startActivity(intent);
            }
        });

        TextView title = customViewHold.getView(R.id.title);
        title.setText(item.getTitle());

        TextView time = customViewHold.getView(R.id.time);
        time.setText(item.getBegin_time_ext());

        TextView area = customViewHold.getView(R.id.area);
        area.setText(item.getArea());

        TextView price = customViewHold.getView(R.id.price);


        if ("0".equals(item.getFee())) {
            price.setText("免费");
        } else {
            price.setText(item.getFee());
        }
    }
}
